﻿@model FairyWorld.Models.LogOnModel

@{
    ViewBag.Title = "登录";
}

<link href="@Url.Content("~/Content/themes/messenger/messenger.css")" rel="stylesheet" type="text/css"/>
<link href="@Url.Content("~/Content/themes/messenger/messenger-theme-future.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/messenger.min.js")" type="text/javascript"></script>

<script type="text/javascript">
    $(document).ready(function () {
        $("#UserName").attr("placeholder", "邮箱");
        $("#Password").attr("placeholder", "密码");
        $("#headli1").attr("class", "active");
        $("#headli2").attr("class", "");
        $("#headli3").attr("class", "");
        $("#headli4").attr("class", "");
    })

    function sendemail() {
        
        var emailaddress = $("#emailforgotton").val();
        $.post("/Account/SendForgottenPassword", { "email": emailaddress },
            function (data) {
                if (data == 1)
                    $.globalMessenger().post("密码找回邮件已发送成功！");
                else if (data == 0)
                    $.globalMessenger().post({
                        message: '输入为空或该邮箱未被注册！',
                        type: 'error',
                        showCloseButton: true
                    });
            }
            );
        $('#forget').modal('hide');
        //window.location.href = "/Account/LogOn";
    }
</script>

<style type="text/css">
        .editor-field
        {
            margin-top:10px;
        }
        .editor-label
        {
            margin-top:10px;
        }
 </style>

<div class="container">
    <h3>登录</h3>
    <p>
        请输入邮箱和密码。如果您没有帐户，请 @Html.ActionLink("注册", "Register")。
    </p>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@Html.ValidationSummary(true, "")
</div>

@using (Html.BeginForm()) {
    <div class="container">
            <div class="editor-field">
                @Html.TextBoxFor(m => m.UserName)
                @Html.ValidationMessageFor(m => m.UserName)
            </div>
            <div class="editor-field">
                @Html.PasswordFor(m => m.Password)
                @Html.ValidationMessageFor(m => m.Password)
            </div>
            <div class="editor-label">
                @Html.CheckBoxFor(m => m.RememberMe)
                记住我？&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <a href="#forget" data-toggle="modal">找回密码</a>
            </div>

            <p style="margin-top:20px">
                <input type="submit" value="登录" class="btn btn-primary"/>
            </p>
    </div>
}
<div id="forget" class="modal hide fade">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <div class="text" style="font-family:'Microsoft YaHei'; font-weight:600; font-size:larger">找回密码</div>
    </div>
    <div class="modal-body">
        邮箱&nbsp;&nbsp;<input class="input-xlarge" id="emailforgotton" type="text" placeholder="您的注册邮箱是...">
    </div>
    <div class="modal-footer">
        <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
        <button class="btn btn-primary" onclick="sendemail()">发送邮件</button>
    </div>
</div>
